/*
 * client.cpp
 *
 *  Created on: 15/04/2012
 *      Author: david
 */

#include "TcpClient.h"
#include <cstring>
#include <stdio.h>

using namespace stk;

int main(){
	char buffer[256];
	char * buffer_read = buffer;
	TcpClient client(2006,"localhost"); 
	printf("Connection complete\n");
	
	//printf("Enter the message: \n");
	//fgets(buffer,255,stdin);
	
	printf("intentando recibir un mensaje del servidor\n");
	
	//éste si hace espera bloqueante, pero no recibe!
	
	int rb = client.readBuffer((char *)buffer_read,1,0);
	
	printf("Message received: %s\n",buffer_read);
	//int wb =client.writeBuffer((const void *)buffer,255,0);
	
	printf("%i\n",rb);
	
	return 0;

}
